package com.desksoft.service;

import java.util.List;
import java.util.Map;

import com.desksoft.common.BaseService;
import com.desksoft.dao.CategoryDetailDao;
import com.desksoft.entity.Categorydetail;

/**
 * @author forever
 *
 */
public class CategoryDetailService extends BaseService<Categorydetail> {

	private CategoryDetailDao  categoryDetailDao;

	public List<Categorydetail> findByParentId(String categoryId) {
		return categoryDetailDao.selectByParentId(categoryId);
	}
	
	
	public Integer insertSelective(Categorydetail categorydetail) {
		return categoryDetailDao.insertSelective(categorydetail);
	}
	
	
	public CategoryDetailDao getCategoryDetailDao() {
		return categoryDetailDao;
	}

	public void setCategoryDetailDao(CategoryDetailDao categoryDetailDao) {
		this.categoryDetailDao = categoryDetailDao;
	}


	@Override
	public Integer delete(String id) {
		return categoryDetailDao.deleteByPrimaryKey(id);
	}


	@Override
	public Integer updateSequ(List<Map<String, Object>> listSequ) {
		Integer f = 0 ;
		for(Map<String, Object> map : listSequ){
			Integer temp = categoryDetailDao.updateSequ(map);
			if(temp == 1){
				f++;
			}
		}
		if(listSequ.size() == f){
			return 1 ;
		}
		return 0 ;
	}
}
